<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="vue.js"></script>
    <title>Document</title>
    <style>
        #box .on {
            background: url('on.png') no-repeat;
        }

        #box div {
            width: 56px;
            height: 59px;
            float: left;
            background: url('off.png') no-repeat;
        }
    </style>
</head>

<body>
    <div id="box">
        <div v-for="n in 5" @click="Selected(n)" :class="{'on':cur>=n}">
        </div>
    </div>
    <script>
        var vm = new Vue({
            el: '#box',
            data: {
                cur: -1,
                flag: false //鼠标点击后变成true，鼠标进入进出事件就不会改变背景图
            },
            methods: {

                Selected(n) {
                    this.flag = true;
                    this.cur = n;
                }
            }
        });
    </script>
</body>

</html>